import 'package:flutter/material.dart';

class AbsorbPointerPage extends StatelessWidget {
  const AbsorbPointerPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('AbsorbPointerPage')),
      body: Center(
        child: Column(
          children: [
            const Spacer(),
            SizedBox(
              width: 240.0,
              height: 50.0,
              child: ElevatedButton(
                onPressed: () {
                  // ignore: avoid_print
                  print('click it...');
                }, 
                child: null,
              )
            ),
            const Spacer(),
            SizedBox(
              width: 240.0,
              height: 50.0,
              child: AbsorbPointer(
                child: ElevatedButton(
                  style: ElevatedButton.styleFrom(primary: Colors.blue.shade200),
                  onPressed: () {
                    print('click it 2 ...');
                  },
                  child: null,
                ),
              ),
            ),
            const Spacer(),
            Listener(
              onPointerDown: (v) {
                print('click blue self');
              },
              child: AbsorbPointer(
                child: Listener(
                  onPointerDown: (v) {
                    print('click blue child');
                  },
                  child: Container(
                    color: Colors.blue,
                    width: 240,
                    height: 100,
                  ),
                ),
              ),
            ),
            const Spacer(),
          ],
        ),
      ),
    );
  }
}